DELETE t FROM c1_role_permission t WHERE NOT EXISTS (SELECT 1 FROM c1_permission e WHERE e.id = t.`PERMISSION_ID`)